package com.chenfan.process.service.impl;

import java.util.Collection;
import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chenfan.process.entity.po.ApprovalSnapshotPo;
import com.chenfan.process.repository.ApprovalSnapshotPoRepository;
import com.chenfan.process.service.ApprovalSnapshotPoService;

/**
 * @author liuming
 * @date 2021/10/19
 */
@Service
public class ApprovalSnapshotPoServiceImpl extends ServiceImpl<ApprovalSnapshotPoRepository, ApprovalSnapshotPo>
    implements ApprovalSnapshotPoService {

    @Override
    public List<ApprovalSnapshotPo> listByApprovalId(Collection<Long> approvalIdList) {
        QueryWrapper<ApprovalSnapshotPo> query = new QueryWrapper<>();
        query.in(ApprovalSnapshotPo.Constants.APPROVAL_ID, approvalIdList);
        return list(query);
    }

    @Override
    public ApprovalSnapshotPo getByApprovalId(Long approvalId) {
        QueryWrapper<ApprovalSnapshotPo> query = new QueryWrapper<>();
        query.eq(ApprovalSnapshotPo.Constants.APPROVAL_ID, approvalId);
        return this.getOne(query);
    }
}
